<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'questao-form',
	'enableAjaxValidation'=>true,
)); ?>

	<p class="note">Campos marcados com <span class="required">*</span> são obrigatórios.</p>
        
        <?php if($model->isNewRecord): ?>
            <?php echo $form->errorSummary(array($model,$eixoQuestao)); ?>
        <?php else: ?>
            <?php echo $form->errorSummary($model); ?>
        <?php endif; ?>
        
        <fieldset>
            
            <legend> Geral </legend>
            
            <div class="row">
                <?php echo $form->labelEx($model,'descricao_questao'); ?>
                <?php echo $form->textField($model,'descricao_questao',array('size'=>70,'maxlength'=>200,'style'=>'font-size: 150%;')); ?>
                <?php echo $form->error($model,'descricao_questao'); ?>
            </div>

        </fieldset>
        
        <?php if($model->isNewRecord): ?>
        
        <fieldset>
            
                <legend> Peso nos Eixos </legend>

                <table class="grid-view">
                    <thead>
                        <tr>
                            <th style="width: 300px;"><?php echo $form->label($eixoQuestao,'id_eixo') ?></th>
                            <th style="width: 40px;"><?php echo $form->labelEx($eixoQuestao,'peso'); ?></th>
                            <th><?php echo $form->labelEx($eixoQuestao,'justificativa'); ?></th>
                        </tr>
                    </thead>

                    <tbody>

                        <?php foreach($eixosQuestionario as $eixo): ?>

                        <tr onmousemove="this.style.backgroundColor='#f4f4f4'" onmouseout="this.style.backgroundColor='#fff'">
                            <td><?php echo $eixo->eixos->nome_eixo; ?><?php echo $form->hiddenField($eixoQuestao,'['.$eixo->id_eixo.']id_eixo',array('value'=>$eixo->id_eixo)); ?></td>
                            <td><?php echo $form->textField($eixoQuestao,'['.$eixo->id_eixo.']peso',array('maxlength'=>'2','size'=>'1')); ?></td>
                            <td><?php echo $form->textField($eixoQuestao,'['.$eixo->id_eixo.']justificativa',array('maxlength'=>'200','size'=>'44')); ?></td>
                        </tr>

                        <?php endforeach; ?>

                    </tbody>

                </table>

            </fieldset>
        
        <?php else: ?>
        
            <fieldset>

                <legend> Peso nos Eixos </legend>

                <table class="grid-view">
                    <thead>
                        <tr>
                            <th style="width: 300px;">Eixo</th>
                            <th style="width: 40px;">Peso</th>
                            <th>Justificativa</th>
                        </tr>
                    </thead>

                    <tbody>

                        <?php foreach($eixosQuestao as $eixo): ?>

                        <tr onmousemove="this.style.backgroundColor='#f4f4f4'" onmouseout="this.style.backgroundColor='#fff'">
                            <td><?php echo $eixo->eixos->nome_eixo; ?></td>
                            <td><?php echo $eixo->peso ?></td>
                            <td><?php echo $eixo->justificativa; ?></td>
                        </tr>

                        <?php endforeach; ?>

                    </tbody>

                </table>

            </fieldset>
        
        
        <?php endif; ?>
                
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Salvar' : 'Salvar Alterações'); ?>
	</div>
        
<?php $this->endWidget(); ?>

</div><!-- form -->